Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


Errors And Error Reporting Conventions

The USB software uses a "return errors, set references" convention. In this convention, all APIs return a common OSStatus type. PipeRef, DeviceRef, InterfaceRef, and endpointRef reference numbers are all in a field of the parameter block passed to the function. No reference variables do double duty. That is, they do not report both error codes and reference numbers (refnums). There is one exception to this however, a reference number of nil is an indication that the reference number has not been set properly.

Error codes returned by the USL are in the range -6900 to -6999 and are listed in USL Error Codes .

The following discussion deals with common causes of errors returned by the USL

Device Access Errors

Any function that accesses a device may give one of the transfer mode errors. Transfer mode errors cause a pipe stall on non-default pipes. The transfer errors are in the range -6901 through -6915 as follows:

kUSBCRCErr -6913 Pipe stall, bad CRC
kUSBBitstufErr -6914 Pipe stall, bitstuffing
kUSBDataToggleErr -6913 Pipe stall, bad data toggle
kUSBEndpointStallErr -6912 Device didn't understand
kUSBNotRespondingErr -6911 Pipe stall, no device, device hung
kUSBPIDCheckErr -6910 Pipe stall, PID CRC error
kUSBWrongPIDErr -6909 Pipe stall, bad or wrong PID
kUSBOverRunErr -6908 Packet too large or more data than allocated buffer
kUSBUnderRunErr -6907 Less data than buffer
kUSBBufOvrRunErr -6904 Host hardware failure on data in, PCI busy?
kUSBBufUnderRunErr -6903 Host hardware failure on data out, PCI busy?
kUSBNotSent1Err -6902 Transaction not sent
kUSBNotSent2Err -6901 Transaction not sent

The kUSBNotRespondingError most often occurs when a device is unplugged. A driver should prepare to be deleted, if it gets this error. This error may occur when a device is hung, or when a bus error occurs.

Errors on the USB Bus

Errors on the USB bus occur when a device is behaving erratically or there are bad cables or connectors. USB bus errors include:

kUSBCRCErr -6913 Pipe stall, bad CRC
kUSBBitsufErr -6914 Pipe stall, bitstuffing
kUSBDataToggleErr -6913 Pipe stall, bad data toggle
kUSBPIDCheckErr -6910 Pipe stall, PID CRC error
kUSBWrongPIDErr -6909 Pipe stall, bad or wrong PID

The USB bus errors are uncommon and should rarely be seen.

Incorrect Command Errors

When a device receives an incorrect command or a command it cannot comply with, it stalls the pipe and returns a kUSBEndpointStallErr .

Driver Logic Errors

The kUSBOverRunErr and kUSBUnderRunErr are usually caused by logic errors in the driver. In most cases, the driver and the device are not in agreement as to how much data is to be transferred.

An over run error occurs most often when a buffer is not an exact multiple of the maximum packet size ( maxPacketSize ), and the controller determines that the last packet will overflow the end of the buffer. This also occurs if a packet is sent that is larger than the maximum packet size. This is often a protocol error and the sign of a bad device.

In version 1.0 of the USB Services Library software, this error can occur if the transfer buffer is not aligned to the maximum packet size of the endpoint. This problem will be addressed in a later revision of the Mac OS USB software.

Under run errors occur when a packet shorter that the maximum packet size is received. It is the pipe policy to treat this situation as an error. In version 1.0 underrun errors are usually not generated. Short packets always cause a normal completion. The option to make short packets an error will be addressed in a later revision of the USB software.

PCI Bus Busy Errors

Errors may be generated if the PCI bus is busy for extended periods of time. These errors include kUSBBufOverRunErr and kUSBBufUnderRunErr .


© 1998 Apple Computer, Inc. – (Last Updated 23 Nov 98)

Previous | Back Up One Level | Next |